package books.borrowing.bo.impl;

import java.util.List;

import javax.xml.ws.WebServiceRef;

import org.springframework.stereotype.Component;

import books.borrowing.bo.IAuthorManagerClientService;
import books.storage.service.AuthorDto;
import books.storage.service.AuthorsManagerBean;
import books.storage.service.AuthorsManagerBeanService;
import books.storage.service.EntityNotFoundException_Exception;

@Component
public class AuthorManagerClientServiceImpl implements IAuthorManagerClientService {

    @WebServiceRef(wsdlLocation = "http://localhost:8080/AuthorsManagerBeanService/AuthorsManagerBean?wsdl", value = AuthorsManagerBeanService.class)
    //Interface generated by wsimport
    private AuthorsManagerBean _bean;

    public AuthorDto addNewAuthor(AuthorDto _author) throws EntityNotFoundException_Exception {
    	return _bean.addNewAuthor(_author);
    }
    
    public AuthorDto updateAuthor(AuthorDto _author) throws EntityNotFoundException_Exception {
    	return _bean.updateAuthor(_author);
    }
    
    public void removeAuthor(AuthorDto _author) throws EntityNotFoundException_Exception {
    	_bean.deleteAuthor(_author);
    }
    
    public AuthorDto findAuthor(Integer _id) throws EntityNotFoundException_Exception {
    	return _bean.findAuthorDto(_id);
    }
    
    public AuthorDto findAuthorByName(String _name) {
    	return _bean.authorByName(_name);
    }
    
    public List<AuthorDto> findAuthorByBook(String _bookTitle) {
    	return _bean.authorByBook(_bookTitle);
    }
    
    public List<AuthorDto> findAllAuthor() {
    	return _bean.findAllAuthors();
    }
    
}
